package com.topcheer.gateway.common;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * @author xutao
 * @Package com.topcheer.gateway.common
 * @Description: ${todo}
 * @date 2020/1/2 17:06
 */
@ControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ResponseStatus(code = HttpStatus.INTERNAL_SERVER_ERROR)
    public ResultVo defaultExceptionHandler(Exception e){
        log.error("system is error |",e);
        return ResultVo.builder().code(HttpStatus.INTERNAL_SERVER_ERROR.value()).msg(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase()).build();
    }
}
